import * as R from 'ramda'
/**
 * url的对象
 * @type {Iquery}
 * @typedef {{code:string}} Iquery
 */
export const query = R.compose(
    R.reduce((query, i) => ({ ...query, [i[0]]: i[1] }))({}),
    R.map(R.split('=')),
    R.reject(R.isEmpty),
    R.split('&')
)(window.location.search.substring(1))
/**
 *
 * @param jsonData {*}
 * @returns {string}
 */
export const  obj2Query=jsonData=>{
    let str="?"
    R.forEachObjIndexed(
        (value, key)=>{
            str += key+'='+value+'&'
        },
        jsonData
    )
    return str
}